package org.cloud.im.admin.message.controller;

import lombok.extern.slf4j.Slf4j;
import org.cloud.im.admin.common.Result;
import org.cloud.im.admin.handler.StoreHandler;
import org.cloud.im.core.packets.ChatBody;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: w.weidong.lin@abite.com
 * @Description: 消息处理
 * @Date: create in 2021/10/27 16:51
 */
@Slf4j
@RestController
@RequestMapping("/im/message")
public class MessageController {

    @GetMapping("/list")
    @ResponseBody
    public Result<List<ChatBody>> list(@RequestParam("from") String from, @RequestParam("to") String to) {
        return Result.getSuccessResult(StoreHandler.getUserChatInfo(from, to));
    }
}
